<?php
$v_current_style_name = "odd_row";
$v_next_style_name = "round_row";
$v_goto_url = "list/approver-qa/index.php";
$v_count =  sizeof($arr_all_approver_qa);
$arr_unit = get_arr_all_unit($_SESSION['arr_all_unit']);
$v_unit_id = 0;
if(isset($_REQUEST['hdn_unit_id'])){
	$v_unit_id = intval($_REQUEST['hdn_unit_id']);
}
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="large_title">
		<td><?php echo CONST_APPROVER_QA_LIST_ADD_LABEL; ?></td>
	</tr>
</table>
<!-- Bat cac phim: F12=false; Insert=true; Delete=true, ESC=false; Enter=false -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(false,true,true,false,false);">
<!-- bang chua cac tieu thuc loc-->
<table cellpadding="0" cellspacing="0" width="99%">
	<tr>
		<form action="index.php" name="dsp_all_staff_approve_qa" method="post">
		<input name="hdn_list_item_id" type="hidden" value="0">
		<input name="fuseaction" type="hidden" value="DISPLAY_ALL_STAFF">
		<input type="hidden" name="hdn_unit_id" value="<?php echo $v_unit_id; ?>">
	</tr>
	<tr class="normal_label">
		<td align="right"><?php echo CONST_APPROVER_QA_UNIT_NAME_LABEL;?>
			<select class="normal_selectbox" name="sel_unit" style="width:60%"  onChange="sel_change_onclick(this,document.forms(0).hdn_unit_id);">
			<option id="" value="">----------<?php echo _CONST_ALL_LABEL;?>----------</option>
			<?php echo _generate_select_option($arr_unit,0,0,3, $v_unit_id);?>
		  </select>
		</td>
	</tr>
	<tr><td height="5"></td></tr>
</table>
<!--Bang noi dung chua danh sach cac loai hinh xay dung-->
<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="50%"><col width="45%">
	<tr class="header">
		<td>#</td>
		<td><?php echo CONST_APPROVER_QA_NAME_LABEL; ?></td>
		<td><?php echo CONST_APPROVER_QA_UNIT_NAME_LABEL; ?></td>
	</tr>
</table>	
<div style="overflow: auto; width: 100%; height:<?php echo _CONST_HEIGHT_OF_LIST;?>;padding-left:0px;margin:0px">
<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="50%"><col width="45%"><?php
		foreach ($_SESSION['arr_all_staff'] as $v_staff){
			$v_display = true;
			for ($i=0; $i < $v_count ; $i++){
				if ($v_staff['id'] == $arr_all_approver_qa[$i]['1']){
					$v_display = false;
				}
			}
			if ($v_display){
				$v_item_id = $v_staff['id'];
				$v_item_code = $v_staff['code'];
				$v_item_name = $v_staff['name'];
				$v_item_unit_id = $v_staff['unit_id'];
				$v_item_unit_name = _get_item_attr_by_id($_SESSION['arr_all_unit'],$v_item_unit_id,'name');
				$v_item_order = $v_staff['order'];
				if ($v_current_style_name == "odd_row"){
					$v_current_style_name = "round_row";
				}else{
					$v_current_style_name = "odd_row";
				}?>	
				<tr id="tr_staff" class="<?php echo $v_current_style_name ?>" style="display:block;" unit_id ="<?php echo $v_item_unit_id;?>"> 
					<td  align="center" class="normal_label">
						<input type="checkbox" name="chk_item_id" value="<?php echo $v_item_id; ?>">
					</td>	
					<td  align="left" onclick="<?php echo $v_url ;?>" class="normal_label">
						<?php echo $v_item_name; ?>&nbsp;
					</td>
					<td  align="left" onclick="<?php echo $v_url ;?>" class="normal_label">
						<?php echo $v_item_unit_name; ?>&nbsp;
					</td>
				</tr><?php 
			}
			$v_display = true;
		}		
		if ($v_current_style_name == "odd_row"){
			$v_next_style_name = "round_row";
		}else{
			$v_next_style_name = "odd_row";
		}
		echo _add_empty_row($v_count,_CONST_NUMBER_OF_ROW_PER_LIST,$v_current_style_name,$v_next_style_name,3);?>
</table>
</div>
<!--Table chua cac button-->
<table align="center">
	<tr><td height="10"></td></tr>
	<tr>
		<td><?php
			if ($v_is_granted_update ){?>
				<input type="button" value="<?php echo _CONST_SELECT_BUTTON; ?>" name="btn_addlist" class="normal_button" onClick="add_list_onclick(document.forms(0).chk_item_id,document.forms(0).hdn_list_item_id,'ADD_APPROVER_QA')"><?php
			}?>	
				<input type="button" value="<?php echo _CONST_BACK_BUTTON; ?>" name="btn_back" class="normal_button" onClick="goback()">
		</td>
	</tr>
</table>
</div id="hotkey">
</form>

